package com.simon.jkxj.ui.diagnostic

import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.simon.jkxj.R
import com.simon.jkxj.databinding.FragmentDiagnosticBinding

class DiagnosticFragment : Fragment() {
    private var _binding: FragmentDiagnosticBinding? = null
    private val binding get() = _binding!!

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        _binding = FragmentDiagnosticBinding.inflate(inflater, container, false)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        setupViews()
    }

    private fun setupViews() {
        // 设置开始诊断按钮点击事件
        binding.btnStartDiagnostic.setOnClickListener {
            startDiagnosticActivity()
        }
    }

    private fun startDiagnosticActivity() {
        val intent = Intent(requireContext(), DiagnosticActivity::class.java)
        startActivity(intent)
        // 添加过渡动画
        requireActivity().overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left)
    }

    override fun onDestroyView() {
        super.onDestroyView()
        _binding = null
    }
} 